<?php
//openssl genrsa -out rsa_1024_priv.pem 1024
//openssl rsa -pubout -in rsa_1024_priv.pem -out rsa_1024_pub.pem
header('Content-type:text/html;charset=utf-8');
include('Rsa.php');
include('Aes.php');
$data = $_POST;
unset($data['title'], $data['content'], $data['flag']);
//print_r($data);

/*
Array (
[__key__] => bEFJuGc2FUloDQNEBUZ+M7BpfpfXBFxY8/S/YkOZ+fezHLcYzKYBnef1X6XklfF1Trb5dhlf4dYfufaQ/v7j72XECrYRNePQuHcMeGyWYQj6Tr8JKs+NYfR0FQq71X6Ej/JmepHb0JLXLcZ9MYkxt5XDJJMUROv6Sc1rCq9hvzM=
[__iv__] => Og6smvREUeIYQNXmtJhKPqxkbUOiJkpQX5r/cJ15XTEMB/HyxPRBWwHmqvgH2vBVntZMnpQ2nOzbEUaB2CfXUFmiUo67v997l84v7SMxNVt5nIrKLCLG7f+RYBz4JJMoOeJ2NfgHSTylTKdT3qUhzWrtyRX6VYqDPScza1VSQuM=
[__token__] => U2FsdGVkX1/5IRAwGNS2SsJT+OpPEE5HbuHVWU7UoAexhCjESB8m2xwO4HjmW2WS+sYRYGdygWlh3ahs5+lNdzATs5UeZWMO/tPEMXcwjljj/lXjSkvDLig97ma3zuCFmxZzl/KwkB7Q3i7HPsqxNOErL+4XBEW3NxKEuiPcY+umv7H29p0zBenAo7qJPzUADMXGR/JS03ssv61XilEgu08qYaTFY7UHpRcECpKjqCfHNCUYYL+FBAy46fAjWp7MLNqeILxR7TpwdWADVTB8Wq+t6tv9ZisPh9h5Vw/MRx+8T5yF/ELScoU5DpT5FyhipijWZbr8fF9YUmpb0rwVQpIGKRQU/HMUHY8Itz7CzFoSe95YEwhsA/9one4GocRr/abS1KmrZGRb8a3T3wGTvN5tZMEB7t9Uvak5RJ1S6fH/dmJ1Z3bH9Fz5FfTLLpo+ocM/Le+Tq0hXif4Qh+xO/pebam2rj90d+fjlo2F7Hdiv9daYUOi0Dz2Y5F/rJPfQKFtAIaUmnUGIrzmf6L3nUT27Akm0cjlGFRUBV0Bgpz+J7ShEZZPIDOPSYxCGkgxVlFFklMIH6XoqaaXE0oqSOrLBqDam6h8QG63eYoIUVxtlbrfd49Yfm/q/3hKE+2b11Oijdms0gbxKNZTgFiDWVEx5WnrbIfcYYGubgyIVd/ufDdAaa1LqmsM98vAw1l0CLt8KWxFtjd+j+qmQo6ZjICXlMO84AvarUEzBUd44M4Ic7RkBHnVzdyD3jy/EEzmSKu8licqV3m5SiGPUsFkTwxjuFkzx4aYInqGIUDgb+HAb0MJ/rx384044RRbVN9TjPylPrDrHdBksopn52NOwGix0C36m/C9Uu36CnRnCFoUBxpW/Rq40Nt57Ofi5o9y3wh6dZnkcHTy5wvL0kbJq+Q09txT0k3fJyZxXBHt71hJQqUIG1mdJX5F8dWGvjqY9nDAKG4B8NwxRGjEY8HXgGR1+5jOCwAMgpn4Kvosboi8KHjt3BPJMiLymnbds0MlXCsR/FfkNxM7qRQyjbiiVllIdsyVewweRgtZlDea9UFCEjYaMNO0PIJeXTB8CIHkFgsC9wfXCQ8gWtqCco1YjzXVc02S/TWRzDq/ky6SfJQ7HeQjDNCetcyS+MU8T9SMlPOmZHynTcEx6nC2JDZ1ZsX4/rfZHyUbQfRUs3VoMzHd6q2K5POYaVWK/HW7yJBsmDIIvknGOhh9v8cJWxn3IBN9ntIYG+y/gyU0baIifhQ/nnNrbSso03O+0lkohD+Md/x+bro66ovLMaNqGUkTmnxo2vEV0TK58xJ8ElNtXiPqB0lesWsuP5W26IR/bbLElawjnnVg9i74mQVwuRJO32T0XkjkRFcoJoEy41NBMhNU=
)
 * */

$rsa = new Rsa();
$key = $rsa->privDecrypt($data['__key__']);
echo $key;
echo "<br>";

$iv = $rsa->privDecrypt($data['__iv__']);
echo $iv;
echo "<br>";

$aes = new Aes();
$result = $aes->decrypt($data['__token__'], $key, $iv);
parse_str($result, $form);
print_r($form);
